home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 11 - 1995 / 11.02 Feb 95 / Yenta / C Libraries / FileTools.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-04  |  2.0 KB  |  59 lines  |  [TEXT/KAHL]

  1. #pragma once
  2.  
  3. #include <StringTools.h>
  4.  
  5. /*=======================================================================*/
  6. /*= This file contains a set of utilities for handling the File Manager =*/
  7. /*= NOTE: REQUIRES FileTools.RSRC                                        =*/
  8. /*=======================================================================*/
  9.  
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13.  
  14. typedef pascal void (*FDActionProc)(CInfoPBRec *InfoRec, void *UserData);
  15.  
  16.     long    DirIDFromFSSpec (FSSpecPtr theSpec);
  17.     /* given a name, parent ID, and volrefnum in theSpec, return  */
  18.     /* the directory ID of the directory they specify.  Return -1 */
  19.     /* if an error occurs */
  20.     
  21.     FSSpecPtr    FSSpecFromCInfo (CInfoPBPtr CB);
  22.     /* construct and return an FSSpec record describing the file/directory */
  23.     /* whose information is passed in the CBInfoRec structure */
  24.     
  25.     FSSpecPtr    FSSpecFromSFReply (SFReply *SFR);
  26.     /* given a file specification from one of the standard file */
  27.     /* routines, construct an FSSpec for use with the low level file */
  28.     /* routines.  Return FALSE if it cannot be constructed */
  29.     
  30.     long    GetCurrentDirectory (void);
  31.     /* return the ID of the current directory */
  32.     
  33.     short    GetCurrentVolume (void);
  34.     /* return the ID of the current volume */
  35.  
  36.     void    SetCurrentVolume (short newVRefNum);
  37.     /* set the ID of the current volume */
  38.  
  39.     void    SetCurrentDirectory (long newDirID);
  40.     /* set the ID of the current directory */
  41.  
  42.     void    GetDirectory (StandardFileReply *SFReply);
  43.     /* Return the FSSpec of a directory chosen with the std file dialog*/
  44.  
  45.     void    TraverseDirectory (FSSpec *Directory, FDActionProc FileAction,
  46.                                FDActionProc FolderAction, void *UserData);
  47.     /* Given the specification of a directory, traverse its contents */
  48.     /* recursively, applying FileAction to each file, and FolderAction */
  49.     /* to each folder/directory that is encountered */
  50.  
  51.     StringPtr    PathNameFromFSSpec (FSSpecPtr fileID);
  52.     /* given the specification of a file, return its full path name */
  53.  
  54.     StringPtr    PathNameFromCInfo (CInfoPBPtr CB);
  55.     /* given the specification of a file, return its full path name */
  56.  
  57. #ifdef __cplusplus
  58. }
  59. #endif